/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.apli.haiam.ejb.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Informática
 */
@Entity
@Table(name = "far_medicamento")
@NamedQueries({
    @NamedQuery(name = "FarMedicamento.findAll", query = "SELECT f FROM FarMedicamento f")})
public class FarMedicamento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "fmd_id")
    private Integer fmdId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2147483647)
    @Column(name = "fmd_nombre")
    private String fmdNombre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 32)
    @Column(name = "fmd_codigo")
    private String fmdCodigo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "fmd_estado")
    private int fmdEstado;
    @OneToMany(mappedBy = "farMedicamento", fetch = FetchType.LAZY)
    private List<FarFormaFarmaceutica> farFormaFarmaceuticaList;
    @OneToMany(mappedBy = "farMedicamento", fetch = FetchType.LAZY)
    private List<FarMedicamento> farMedicamentoList;
    @JoinColumn(name = "fmd_fmd_id", referencedColumnName = "fmd_id")
    @ManyToOne(fetch = FetchType.LAZY)
    private FarMedicamento farMedicamento;

    public FarMedicamento() {
    }

    public FarMedicamento(Integer fmdId) {
        this.fmdId = fmdId;
    }

    public FarMedicamento(Integer fmdId, String fmdNombre, String fmdCodigo, int fmdEstado) {
        this.fmdId = fmdId;
        this.fmdNombre = fmdNombre;
        this.fmdCodigo = fmdCodigo;
        this.fmdEstado = fmdEstado;
    }

    public Integer getFmdId() {
        return fmdId;
    }

    public void setFmdId(Integer fmdId) {
        this.fmdId = fmdId;
    }

    public String getFmdNombre() {
        return fmdNombre;
    }

    public void setFmdNombre(String fmdNombre) {
        this.fmdNombre = fmdNombre;
    }

    public String getFmdCodigo() {
        return fmdCodigo;
    }

    public void setFmdCodigo(String fmdCodigo) {
        this.fmdCodigo = fmdCodigo;
    }

    public int getFmdEstado() {
        return fmdEstado;
    }

    public void setFmdEstado(int fmdEstado) {
        this.fmdEstado = fmdEstado;
    }

    public List<FarFormaFarmaceutica> getFarFormaFarmaceuticaList() {
        return farFormaFarmaceuticaList;
    }

    public void setFarFormaFarmaceuticaList(List<FarFormaFarmaceutica> farFormaFarmaceuticaList) {
        this.farFormaFarmaceuticaList = farFormaFarmaceuticaList;
    }

    public List<FarMedicamento> getFarMedicamentoList() {
        return farMedicamentoList;
    }

    public void setFarMedicamentoList(List<FarMedicamento> farMedicamentoList) {
        this.farMedicamentoList = farMedicamentoList;
    }

    public FarMedicamento getFarMedicamento() {
        return farMedicamento;
    }

    public void setFarMedicamento(FarMedicamento farMedicamento) {
        this.farMedicamento = farMedicamento;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (fmdId != null ? fmdId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FarMedicamento)) {
            return false;
        }
        FarMedicamento other = (FarMedicamento) object;
        if ((this.fmdId == null && other.fmdId != null) || (this.fmdId != null && !this.fmdId.equals(other.fmdId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.apli.haiam.ejb.entidades.FarMedicamento[ fmdId=" + fmdId + " ]";
    }
    
}
